Add __iomem and __user pointer annotations to linux sparse tree.
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Wed, 23 Nov 2005 13:14:01 +0000 (14:14 +0100)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Wed, 23 Nov 2005 13:14:01 +0000 (14:14 +0100)
Signed-off-by: Vincent Hanquez <vincent@xensource.com>
linux-2.6-xen-sparse/arch/xen/kernel/devmem.c
linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c
linux-2.6-xen-sparse/drivers/xen/evtchn/evtchn.c
linux-2.6-xen-sparse/drivers/xen/privcmd/privcmd.c
linux-2.6-xen-sparse/drivers/xen/util.c
linux-2.6-xen-sparse/include/asm-xen/linux-public/privcmd.h

index 49129dbe14879a0924a66730eca85389812622fe..dd2486ff100f2d3262051f8d61949d3c6839f442 100644 (file)
@@ -45,7 +45,7 @@ static ssize_t read_mem(struct file * file, char __user * buf,
 {
        unsigned long i, p = *ppos;
        ssize_t read = -EFAULT;
-       void *v;
+       void __iomem *v;
 
        if ((v = ioremap(p, count)) == NULL) {
                /*
@@ -75,7 +75,7 @@ static ssize_t write_mem(struct file * file, const char __user * buf,
 {
        unsigned long p = *ppos;
        ssize_t written = -EFAULT;
-       void *v;
+       void __iomem *v;
 
        if ((v = ioremap(p, count)) == NULL)
                return -EFAULT;
index a88ba313155f3cdc0393907ad5f0f8deb931c683..cab043c15cbe642bcfa7caeaf487263140be37a4 100644 (file)
@@ -441,7 +441,7 @@ int blkif_ioctl(struct inode *inode, struct file *filep,
        case CDROMMULTISESSION:
                DPRINTK("FIXME: support multisession CDs later\n");
                for (i = 0; i < sizeof(struct cdrom_multisession); i++)
-                       if (put_user(0, (char *)(argument + i)))
+                       if (put_user(0, (char __user *)(argument + i)))
                                return -EFAULT;
                return 0;
 
index 85c65e95a8b4c70bd74e7b4f1eca6da5f7c9b8a5..b3201a984d973850885e95049ff80f9957e30d4c 100644 (file)
@@ -89,7 +89,7 @@ void evtchn_device_upcall(int port)
        spin_unlock(&port_user_lock);
 }
 
-static ssize_t evtchn_read(struct file *file, char *buf,
+static ssize_t evtchn_read(struct file *file, char __user *buf,
                            size_t count, loff_t *ppos)
 {
        int rc;
@@ -168,7 +168,7 @@ static ssize_t evtchn_read(struct file *file, char *buf,
        return rc;
 }
 
-static ssize_t evtchn_write(struct file *file, const char *buf,
+static ssize_t evtchn_write(struct file *file, const char __user *buf,
                             size_t count, loff_t *ppos)
 {
        int  rc, i;
@@ -220,6 +220,7 @@ static int evtchn_ioctl(struct inode *inode, struct file *file,
 {
        int rc;
        struct per_user_data *u = file->private_data;
+       void __user *uarg = (void __user *) arg;
        evtchn_op_t op = { 0 };
 
        switch (cmd) {
@@ -227,7 +228,7 @@ static int evtchn_ioctl(struct inode *inode, struct file *file,
                struct ioctl_evtchn_bind_virq bind;
 
                rc = -EFAULT;
-               if (copy_from_user(&bind, (void *)arg, sizeof(bind)))
+               if (copy_from_user(&bind, uarg, sizeof(bind)))
                        break;
 
                op.cmd = EVTCHNOP_bind_virq;
@@ -246,7 +247,7 @@ static int evtchn_ioctl(struct inode *inode, struct file *file,
                struct ioctl_evtchn_bind_interdomain bind;
 
                rc = -EFAULT;
-               if (copy_from_user(&bind, (void *)arg, sizeof(bind)))
+               if (copy_from_user(&bind, uarg, sizeof(bind)))
                        break;
 
                op.cmd = EVTCHNOP_bind_interdomain;
@@ -265,7 +266,7 @@ static int evtchn_ioctl(struct inode *inode, struct file *file,
                struct ioctl_evtchn_bind_unbound_port bind;
 
                rc = -EFAULT;
-               if (copy_from_user(&bind, (void *)arg, sizeof(bind)))
+               if (copy_from_user(&bind, uarg, sizeof(bind)))
                        break;
 
                op.cmd = EVTCHNOP_alloc_unbound;
@@ -285,7 +286,7 @@ static int evtchn_ioctl(struct inode *inode, struct file *file,
                int ret;
 
                rc = -EFAULT;
-               if (copy_from_user(&unbind, (void *)arg, sizeof(unbind)))
+               if (copy_from_user(&unbind, uarg, sizeof(unbind)))
                        break;
 
                rc = -EINVAL;
@@ -318,7 +319,7 @@ static int evtchn_ioctl(struct inode *inode, struct file *file,
                struct ioctl_evtchn_notify notify;
 
                rc = -EFAULT;
-               if (copy_from_user(&notify, (void *)arg, sizeof(notify)))
+               if (copy_from_user(&notify, uarg, sizeof(notify)))
                        break;
 
                if (notify.port >= NR_EVENT_CHANNELS) {
index 7e9aceaaae42719b37c3e230236682be3d604a93..0b0084b31e02c81e410fad17477a1d3c3faa2754 100644 (file)
@@ -38,13 +38,13 @@ static int privcmd_ioctl(struct inode *inode, struct file *file,
                          unsigned int cmd, unsigned long data)
 {
        int ret = -ENOSYS;
+       void __user *udata = (void __user *) data;
 
        switch (cmd) {
        case IOCTL_PRIVCMD_HYPERCALL: {
                privcmd_hypercall_t hypercall;
   
-               if (copy_from_user(&hypercall, (void *)data,
-                                  sizeof(hypercall)))
+               if (copy_from_user(&hypercall, udata, sizeof(hypercall)))
                        return -EFAULT;
 
 #if defined(__i386__)
@@ -97,10 +97,11 @@ static int privcmd_ioctl(struct inode *inode, struct file *file,
        case IOCTL_PRIVCMD_MMAP: {
 #define PRIVCMD_MMAP_SZ 32
                privcmd_mmap_t mmapcmd;
-               privcmd_mmap_entry_t msg[PRIVCMD_MMAP_SZ], *p;
+               privcmd_mmap_entry_t msg[PRIVCMD_MMAP_SZ];
+               privcmd_mmap_entry_t __user *p;
                int i, rc;
 
-               if (copy_from_user(&mmapcmd, (void *)data, sizeof(mmapcmd)))
+               if (copy_from_user(&mmapcmd, udata, sizeof(mmapcmd)))
                        return -EFAULT;
 
                p = mmapcmd.entry;
@@ -146,12 +147,12 @@ static int privcmd_ioctl(struct inode *inode, struct file *file,
                mmu_update_t u;
                privcmd_mmapbatch_t m;
                struct vm_area_struct *vma = NULL;
-               unsigned long *p, addr;
-               unsigned long mfn; 
+               unsigned long __user *p;
+               unsigned long addr, mfn; 
                uint64_t ptep;
                int i;
 
-               if (copy_from_user(&m, (void *)data, sizeof(m))) {
+               if (copy_from_user(&m, udata, sizeof(m))) {
                        ret = -EFAULT;
                        goto batch_err;
                }
@@ -219,7 +220,7 @@ static int privcmd_ioctl(struct inode *inode, struct file *file,
                pmd_t *pmd; 
                unsigned long m2pv, m2p_mfn;    
                privcmd_m2pmfns_t m; 
-               unsigned long *p; 
+               unsigned long __user *p;
                int i; 
 
 #if defined (__x86_64__)
@@ -233,7 +234,8 @@ static int privcmd_ioctl(struct inode *inode, struct file *file,
                ret = -EINVAL; 
                break; 
 #endif
-               if (copy_from_user(&m, (void *)data, sizeof(m)))
+
+               if (copy_from_user(&m, udata, sizeof(m)))
                        return -EFAULT;
 
                m2pv = (unsigned long)machine_to_phys_mapping;
index be2b155cf1f509fd982e0c87817923024bd3f9d4..84906d96757daff10693b0fa646a930da9fa13dc 100644 (file)
@@ -56,7 +56,7 @@ void lock_vm_area(struct vm_struct *area)
         * page-fault path will copy the page directory pointers from init_mm.
         */
        for (i = 0; i < area->size; i += PAGE_SIZE)
-               (void)__get_user(c, (char *)area->addr + i);
+               (void)__get_user(c, (char __user *)area->addr + i);
 }
 
 void unlock_vm_area(struct vm_struct *area)
index a883d68597b13e5a4b4b791acc6c5763cb44fe0f..3c91205855053f727815f725ee8f9355aec2ea8c 100644 (file)
 #ifndef __LINUX_PUBLIC_PRIVCMD_H__
 #define __LINUX_PUBLIC_PRIVCMD_H__
 
+#ifndef __user
+#define __user
+#endif
+
 typedef struct privcmd_hypercall
 {
        unsigned long op;
@@ -45,19 +49,19 @@ typedef struct privcmd_mmap_entry {
 typedef struct privcmd_mmap {
        int num;
        domid_t dom; /* target domain */
-       privcmd_mmap_entry_t *entry;
+       privcmd_mmap_entry_t __user *entry;
 } privcmd_mmap_t; 
 
 typedef struct privcmd_mmapbatch {
        int num;     /* number of pages to populate */
        domid_t dom; /* target domain */
        unsigned long addr;  /* virtual address */
-       unsigned long *arr; /* array of mfns - top nibble set on err */
+       unsigned long __user *arr; /* array of mfns - top nibble set on err */
 } privcmd_mmapbatch_t; 
 
 typedef struct privcmd_m2pmfns { 
        int num;    /* max number of mfns to return */
-       unsigned long *arr; /* array of mfns */
+       unsigned long __user *arr; /* array of mfns */
 } privcmd_m2pmfns_t; 
 
 typedef struct privcmd_blkmsg